package cn.xuguowen.tool;

import org.apache.commons.lang.StringUtils;

import java.util.Arrays;
import java.util.List;

/**
 * ClassName: LetterUtils
 * Package: cn.xuguowen.tool
 * Description:
 *
 * @Author 徐国文
 * @Create 2023/4/24 15:19
 * @Version 1.0
 */
public class LetterUtils {
    /**
     * 字母转数字
     */
    public static long letterToNumber(String letter) {
        int length = letter.length();
        long number = 0;
        for (int i = 0; i < length; i++) {
            char ch = letter.charAt(length - i - 1);
            int num = ch - 'A' + 1;
            number += num;
        }
        return number;
    }

    /**
     * 字符串拼接
     */
    public static String assembleHandler(char splitChar, String... args) {
        List<String> strList = Arrays.asList(args);
        return StringUtils.join(strList, splitChar);
    }

    public static void main(String[] args) {
        String a = "a";
        String b = "b";
        String c = "c";

        String result = assembleHandler('-', a, b, c);
        System.out.println(result);
    }

}
